class XOption:
    
    def __init__(self, data): self.data = data 
    def isEmpty(self): return self.data==None
    def getOrElse(self, els): return els if self.isEmpty() else self.data
    def get(self): return None if self.isEmpty() else self.data 
    def map(self, f): return XOption(None) if self.isEmpty() else XOption(f(self.data))
    def fold(self, f, init): return init if self.isEmpty() else f(self.data)
    def contains(self, e): return False if self.isEmpty() else e==self.data 

    def __eq__(self, b): return self.data == b.data


def XSome(data): return XOption(data)

class _XNone_(XOption):
    def __init__(self): self.data = None

XNone = _XNone_()